package com.xcity.game.buildv2;

import com.alibaba.fastjson.annotation.JSONField;
import com.xcity.game.buildv2.template.BuildTemplateV2.PartTemplate;

public class BuildV2Part {
	
	@JSONField(serialize = false)
	protected int index; // 部位索引
	@JSONField(name = "0")
	protected int level;
	@JSONField(name = "1")
	protected byte state; // 0-被损坏, 1-正常
	@JSONField(name = "2")
	protected int maxLevelBeforeBroken; // 被损坏前的最高等级
	public static final byte STATE_BROKEN = 0, STATE_NORMAL = 1;
	public static final int MAX_LEVEL = 5;
	
	@JSONField(serialize = false)
	public PartTemplate template;
	
	public BuildV2Part() {}
	
	public BuildV2Part(int index, PartTemplate template) {
		this.index = index;
		this.level = 0;
		this.state = STATE_NORMAL;
		this.template = template;
	}

	public int getIndex() {
		return index;
	}

	public void setIndex(int index) {
		this.index = index;
	}

	public int getLevel() {
		return level;
	}

	public void setLevel(int level) {
		this.level = level;
	}

	public byte getState() {
		return state;
	}

	public void setState(byte state) {
		this.state = state;
	}

	public int getMaxLevelBeforeBroken() {
		return maxLevelBeforeBroken;
	}

	public void setMaxLevelBeforeBroken(int maxLevelBeforeBroken) {
		this.maxLevelBeforeBroken = maxLevelBeforeBroken;
	}

	public PartTemplate getTemplate() {
		return template;
	}

	public void setTemplate(PartTemplate template) {
		this.template = template;
	}
	
}
